<template>
  <div id="app">
    <router-view v-if="isRouterAlive" />
  </div>
</template>

<script setup lang="ts">
import { ref, provide, getCurrentInstance, ComponentInternalInstance, nextTick } from 'vue';
const { appContext } = getCurrentInstance() as ComponentInternalInstance;
const proxy = appContext.config.globalProperties;

const isRouterAlive = ref(true);

const reload = () => {
  if (proxy.$storage.getItem('searchKeywords')) {
    var keywords = proxy.$storage.getItem('searchKeywords');
  }
  isRouterAlive.value = false;
  nextTick(() => {
    if (keywords) {
      proxy.$storage.setItem('searchKeywords', keywords);
    }
    isRouterAlive.value = true;
  });
}

provide('reload', reload);
</script>

<style>
#nprogress .bar {
  background: #409eff !important;
}

::-webkit-scrollbar {
  width: 8px;
  height: 4px;
  background-color: #ebeef5;
}

::-webkit-scrollbar-thumb {
  box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
  -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
  background-color: #ccc;
  height: 20px;
  border-radius: 4px !important;
}

::-webkit-scrollbar-track {
  box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
  border-radius: 3px;
  background: rgba(255, 255, 255, 1);
}
</style>
